import QtQuick
import QtQuick.Controls.Fusion
import QtQuick.Layouts
import Gui.Components
import Gui.Global as G

Rectangle {
    id: root

    property int selectedView: -1
    property ListModel siderBtnsModel

    ColumnLayout {
        id: sliderLayout
        anchors.fill: parent
        spacing: 0
        Item {
            Layout.preferredHeight: parent.width + 10
            Layout.preferredWidth: parent.width
            Image {
                width: parent.width - 20
                height: parent.width - 20
                source: "qrc:/Gui/Static/images/logo.jpg"
                anchors.centerIn: parent
            }
        }
        Repeater {
            id: siderBarBtns
            model: siderBtnsModel
            IconButton {
                id: siderBtn
                required property var modelData
                required property int index

                Layout.preferredWidth: parent.width
                Layout.preferredHeight: parent.width
                iconSize: root.width - 30
                cursorShape: Qt.PointingHandCursor
                autoExclusive: true
                checkable: true
                iconName: modelData.iconName
                tipName: modelData.name
                checkedColor: root.palette.button

                onClicked: {
                    root.selectedView = index;
                }

                Rectangle {
                    id: siderLine
                    width: siderBtn.checked ? 4 : 0
                    height: parent.height
                    color: root.palette.highlight

                    Behavior on width {
                        NumberAnimation {
                            duration: 200
                        }
                    }
                }
            }
        }

        Item {
            Layout.fillHeight: true
        }
    }
    Component.onCompleted: {
        siderBarBtns.itemAt(0).click();
    }
}
